package com.itwn.web;

import com.itwn.service.UserService;
import com.itwn.util.SpringUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/del")
public class DelServlet extends BaseServlet{
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        UserService userService = (UserService)SpringUtil.getBean("userServiceImpl");
        if (id!=null||id!="null"){
            userService.delUserById(Integer.parseInt(id));
        }
        resp.sendRedirect(req.getContextPath()+"/list");
    }
}
